package com.wpw.dream.ajaxparam.action;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Controller
@RequestMapping("dataForm")
public class DataFormAction {

	@RequestMapping("/toIndex")
	public String toIndex() {
		return "formdata/formdata";
	}
	
	@RequestMapping("/dataFormAjax")
	@ResponseBody
	public Object dataFormAjax(MultipartFile uploadFile,MultipartFile uploadFile2, String fileName) {
		Map<String, Object> resMap = new HashMap<>();
		resMap.put("fileName", fileName);
		resMap.put("originalFileName1", uploadFile.getOriginalFilename());
		resMap.put("size1", uploadFile.getSize());
		resMap.put("originalFileName2", uploadFile2.getOriginalFilename());
		resMap.put("size2", uploadFile2.getSize());
		return resMap;
		
	}
}
